import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set from '@dfeidao/atom-web/local/set';
import render from '@dfeidao/atom-web/render/render';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import p002 from './p002';

export default async function a004(fd: IFeidaoAiBrowserComponent, a: object, d: number) {
	// todo
	// 得到接收人
	const arr1 = Array();
	console.log('a',a);
	console.log('arr1',arr1);

	for (let i = 0; i < d; i++) {
		arr1.push(JSON.parse(a[i]));
	}
	const icon_down = fd.data.node.querySelector<HTMLLIElement>('[data-id="icon-down"]');
	const pepole = fd.data.node.querySelector<HTMLTextAreaElement>('[data-id="pepole"]');
	if (arr1.length > 8) {
		set_node_cls(icon_down, 'display-n', false);
	}
	const arr2 = Array();
	if (arr1.length > 7) {
		for (let j = 0; j < 7; j++) {
			arr2.push(arr1[j]);
		}
		render(fd, arr2, p002, 'p002', 'inner');
	} else {
		render(fd, arr1, p002, 'p002', 'inner');

	}
	set_node_cls(pepole, 'display-n', false);
	set(fd,'arr', arr1);
	set(fd,'d', d);
}
